home *** CD-ROM | disk | FTP | other *** search
/ Turnbull China Bikeride / Turnbull China Bikeride - Disc 1.iso / ARGONET / PD / MATHS / RLAB / RLAB125.ZIP / !RLaB / rlib / redit < prev    next >
Text File  |  1994-02-21  |  1KB  |  42 lines

  1. //-------------------------------------------------------------------
  2.  
  3. // Syntax:    redit ( F , editor )
  4.  
  5. // Description:
  6.  
  7. // The redit function is a convenient way to edit an rfile, and have
  8. // it automatically re-loaded upon exiting the editor. The argument F
  9. // is a string, and is the name of the rfile (including the extension).
  10.  
  11. // The file must be in the present working directory to function
  12. // properly.
  13.  
  14. // The second string argument is optional, and specifies an editor
  15. // other than the default (vi).
  16. //------------------------------------------------------------------
  17.  
  18. redit = function ( file , editor )
  19. {
  20.   local (ED, r);
  21.  
  22.   if (class (file) != "string") 
  23.   {
  24.     error ("1st argument to edit() must be string");
  25.   }
  26.   if (!exist (editor))
  27.   {
  28.     ED = "vi";
  29.   else
  30.     if (class (editor) != "string")
  31.     {
  32.       error ("2nd argument ot edit() must be string");
  33.     }
  34.     ED = editor;
  35.   }
  36.  
  37.   system (ED + " " + file);
  38.   r = load (file);
  39.   printf ("edited and loaded rfile: %s\n", file);
  40.   return r;
  41. };
  42.